package com.heima.apis.article.schedule;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.schedule.dtos.Task;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author xiaoxiaode
 * @date 2021/10/5 20:18
 **/

@FeignClient("leadnews-schedule")
public interface IscheduleClient {

    /*
    * 添加延时任务
    * */
    @PostMapping("/api/v1/task/add")
    public ResponseResult addTask(@RequestBody Task task);


    /*
     *
     * 取消任务
     * */
    @GetMapping("/api/v1/task/{taskId}")
    public ResponseResult canceTask(@PathVariable("taskId") long taskId);


    /*
     *
     * 按照类型和优先级拉取任务
     * */
    @GetMapping("/api/v1/task/{type}/{priority}")
    public ResponseResult poll(@PathVariable("type")int type, @PathVariable("priority")int priority);


}
